"""
URL configuration for stock_predict project.

The `urlpatterns` list routes URLs to views. For more information please see:
    https://docs.djangoproject.com/en/4.2/topics/http/urls/
Examples:
Function views
    1. Add an import:  from my_app import views
    2. Add a URL to urlpatterns:  path('', views.home, name='home')
Class-based views
    1. Add an import:  from other_app.views import Home
    2. Add a URL to urlpatterns:  path('', Home.as_view(), name='home')
Including another URLconf
    1. Import the include() function: from django.urls import include, path
    2. Add a URL to urlpatterns:  path('blog/', include('blog.urls'))
"""
import os
import sys

from django.conf.urls.static import static
from django.contrib import admin
from django.urls import path, include
from rest_framework import serializers, viewsets, routers
from rest_framework_simplejwt.views import TokenObtainPairView, TokenRefreshView

from . import views, settings

from user_info.views import UserViewSet

# Routers provide an easy way of automatically determining the URL conf.
router = routers.DefaultRouter()
router.register(r'user', UserViewSet)

# Wire up our API using automatic URL routing.
# Additionally, we include login URLs for the browsable API.
urlpatterns = [
    # path('', include(router.urls)),
    path('admin/', admin.site.urls),
    # path('auth/', include('rest_framework.urls', namespace='rest_framework')),
    # path('api/', include(router.urls)),
    path('api/token/', TokenObtainPairView.as_view(), name='token_obtain_pair'),
    path('api/token/refresh/', TokenRefreshView.as_view(), name='token_refresh'),
    # path('', views.index, name="index"),
    path('api/', include('stock.urls', namespace='stock')),
    path('auth/login', views.login, name='login'),
    path('web/api/system/perm/getUserPerm', views.getUserPerm, name='getUserPerm'),
]

# 把媒体文件的路由注册了
# if settings.DEBUG:
#     urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
